<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"movie0125.gitee.io","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="LFS学习笔记（四）本节将LFS中第五章剩下的包都编译完成，内容及其枯燥无味。">
<meta property="og:type" content="article">
<meta property="og:title" content="lfs-notebook-04">
<meta property="og:url" content="https://movie0125.gitee.io/2021/05/18/lfs-notebook-04/index.html">
<meta property="og:site_name" content="Movie Blog">
<meta property="og:description" content="LFS学习笔记（四）本节将LFS中第五章剩下的包都编译完成，内容及其枯燥无味。">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-05-18T08:24:28.000Z">
<meta property="article:modified_time" content="2021-05-19T06:44:10.941Z">
<meta property="article:author" content="Movie">
<meta property="article:tag" content="LFS">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://movie0125.gitee.io/2021/05/18/lfs-notebook-04/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>lfs-notebook-04 | Movie Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Movie Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">拥抱开源，快乐分享</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://movie0125.gitee.io/2021/05/18/lfs-notebook-04/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Movie">
      <meta itemprop="description" content="学习，记录，分享，收获">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Movie Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          lfs-notebook-04
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-05-18 16:24:28" itemprop="dateCreated datePublished" datetime="2021-05-18T16:24:28+08:00">2021-05-18</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-05-19 14:44:10" itemprop="dateModified" datetime="2021-05-19T14:44:10+08:00">2021-05-19</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" itemprop="url" rel="index"><span itemprop="name">学习笔记</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021/05/18/lfs-notebook-04/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021/05/18/lfs-notebook-04/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="LFS学习笔记（四）"><a href="#LFS学习笔记（四）" class="headerlink" title="LFS学习笔记（四）"></a>LFS学习笔记（四）</h1><pre><code>本节将LFS中第五章剩下的包都编译完成，内容及其枯燥无味。</code></pre>
<a id="more"></a>

<h2 id="Tcl-8-6-9"><a href="#Tcl-8-6-9" class="headerlink" title="Tcl-8.6.9"></a>Tcl-8.6.9</h2><p>此软件包和后面两个包（Expect 和 DejaGNU）用来为 GCC 和 Binutils 还有其他的一些软件包的测试套件提供运行支持。仅仅为了测试目的而安装三个软件包，看上去有点奢侈，虽然因为大部分重要的工具都能正常工作而并不需要去做测试。尽管在本章中并没有执行测试套件（并不做要求），但是在 第 6 章 中都要求执行这些软件包自带的测试套件。</p>
<p>注意，这里的 Tcl 软件包用的是最小化安装的版本，仅仅是为了运行 LFS 测试。需要完整版的软件包，可参考<a target="_blank" rel="noopener" href="https://www.linuxfromscratch.org/blfs/view/9.0/general/tcl.html">BLFS的Tcl流程</a>。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../tcl8.6.9-src.tar.gz</span><br><span class="line"><span class="built_in">cd</span> tcl8.6.9/unix</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make</span><br><span class="line"></span><br><span class="line"><span class="comment">#现在编译已经完成。之前说过，不强求为本章中所构建的临时工具运行测试套件。不过你仍然要测试 Tcl 的话可以用下面的命令：</span></span><br><span class="line">TZ=UTC make <span class="built_in">test</span></span><br><span class="line"><span class="comment">#Tcl 测试套件在宿主机某些特定条件下会失败，原因很难推测。不过测试套件失败并不奇怪，也不是什么严重的错误。参数 TZ=UTC 设定了时区和相应的世界标准时间（UTC），但是只在测试套件运行期间才有效。这个可以保证时钟测试能正常运行。关于 TZ 环境变量的细节请参阅本手册 第 7 章。</span></span><br><span class="line"></span><br><span class="line">make install</span><br><span class="line"></span><br><span class="line"><span class="comment">#让安装的库文件可写，这样之后可以删除调试符号。</span></span><br><span class="line">chmod -v u+w /tools/lib/libtcl8.6.so</span><br><span class="line"></span><br><span class="line"><span class="comment">#安装 Tcl 的头文件。后面的软件包 Expect 在编译的时候会用到。</span></span><br><span class="line">make install-private-headers</span><br><span class="line"></span><br><span class="line"><span class="comment">#现在创建几个必要的符号链接：</span></span><br><span class="line">ln -sv tclsh8.6 /tools/bin/tclsh</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="Tcl-软件包内容"><a href="#Tcl-软件包内容" class="headerlink" title="Tcl 软件包内容"></a>Tcl 软件包内容</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">安装的程序:  tclsh (link to tclsh8.6) and tclsh8.6</span><br><span class="line">安装的库:  libtcl8.6.so, libtclstub8.6.a</span><br><span class="line">简要介绍 </span><br><span class="line">tclsh8.6           Tcl 命令终端</span><br><span class="line">tclsh              符号链接到 tclsh8.6   </span><br><span class="line">libtcl8.6.so       Tcl 库</span><br><span class="line">libtclstub8.6.a    Tcl Stub 库</span><br></pre></td></tr></table></figure>
<h2 id="Expect-5-45-4"><a href="#Expect-5-45-4" class="headerlink" title="Expect-5.45.4"></a>Expect-5.45.4</h2><p>暂时跳过</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../expect5.45.4.tar.gz  </span><br><span class="line"><span class="built_in">cd</span> expect5.45.4/</span><br><span class="line"></span><br><span class="line"><span class="comment">#首先，强制 Expect 的 configure 配置脚本使用 /bin/stty 替代宿主机系统里可能存在的 /usr/local/bin/stty 。这样可以保证我们的测试套件工具在工具链的最后一次构建能够正常。</span></span><br><span class="line">cp -v configure&#123;,.orig&#125;</span><br><span class="line">sed <span class="string">&#x27;s:/usr/local/bin:/bin:&#x27;</span> configure.orig &gt; configure</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools       \</span><br><span class="line">            --with-tcl=/tools/lib \</span><br><span class="line">            --with-tclinclude=/tools/include</span><br><span class="line">make</span><br><span class="line"></span><br><span class="line"><span class="comment">#编译失败，报错如下 [建议跳过](https://www.linuxquestions.org/questions/linux-from-scratch-13/expect5-45-lfs7-9-a-4175588428/?__cf_chl_jschl_tk__=dd093c41f8a2eefbd60e412095d7f3b6c641b23d-1621329669-0-AY5ZfN6bY_JmRB7eXdK2kMsLOpZkVbWWALGJA2N4WsizoVSO_InUdrvYScgbB5UAHk9sXsWpbsKsgCpNFhfcuqPwUlQ4CyHNMv6c8SKn2U8hBvF9YabRexWC3qL3yBA3s1R_wARQI-WVHKbOD8NTv73iMokrK5egqPRHQ56n4bPwdHClZYOeubaY321-SOfs2vWsdnrgeA2NOa5qRl3-29yudXvmlQuV7fq7caGlsoZy9O-gMxUCFmndpbhvaNTP2-gilN__uz_WDnaVl3LgYNvRsXJ4O5p616N6wyiaUxwNlkdEbcaQ2Ar_U_JIgsHuATcH6gGBcVxmZM9ciMAadLzBxes2d5wjJYv3rDpweKvsoD7bxmx6ygRLl_S_ZBc_yNXxjkd5DjzhZOsFTraJMi8A4z5a0OQeFYr-lsEGnPaiVi7ozXA4XCNK2bFexaRHA1xZ0njBZQV8vw5wjFXpVJmv53stIq_4PgHuVNJP9_JQoyMhx8YJzpL-7NHPyld-OU5YZUICyDlQ3BeZ5HlUwPW-9M3wFVhvGVC_Oe9AXK0e)</span></span><br><span class="line"></span><br><span class="line">(<span class="built_in">echo</span> <span class="string">&#x27;if &#123;![package vsatisfies [package provide Tcl] 8.6]&#125; &#123;return&#125;&#x27;</span> ; \</span><br><span class="line"> <span class="built_in">echo</span> <span class="string">&#x27;package ifneeded Expect 5.45.4 \</span></span><br><span class="line"><span class="string">    [list load [file join $dir libexpect5.45.4.so]]&#x27;</span>\</span><br><span class="line">) &gt; pkgIndex.tcl</span><br><span class="line"></span><br><span class="line"><span class="comment"># 忽略上面的报错，直接安装</span></span><br><span class="line"><span class="comment">#SCRIPTS=&quot;&quot;  这个变量可以避免安装额外的、没有需求的 Expect 脚本。</span></span><br><span class="line">make SCRIPTS=<span class="string">&quot;&quot;</span> install</span><br></pre></td></tr></table></figure>
<h2 id="DejaGNU-1-6-2"><a href="#DejaGNU-1-6-2" class="headerlink" title="DejaGNU-1.6.2"></a>DejaGNU-1.6.2</h2><p>DejaGNU 软件包包含了测试其他程序的框架。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../dejagnu-1.6.2.tar.gz</span><br><span class="line"><span class="built_in">cd</span> dejagnu-1.6.2</span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make install </span><br><span class="line">make check </span><br></pre></td></tr></table></figure>
<h2 id="M4-1-4-18"><a href="#M4-1-4-18" class="headerlink" title="M4-1.4.18"></a>M4-1.4.18</h2><p>M4 软件包包含一个宏处理器。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../m4-1.4.18.tar.xz</span><br><span class="line"><span class="built_in">cd</span> m4-1.4.18</span><br><span class="line"></span><br><span class="line"><span class="comment">#首先，对应 glibc-2.28 的需求做一些修复：</span></span><br><span class="line">sed -i <span class="string">&#x27;s/IO_ftrylockfile/IO_EOF_SEEN/&#x27;</span> lib/*.c</span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;#define _IO_IN_BACKUP 0x100&quot;</span> &gt;&gt; lib/stdio-impl.h</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br></pre></td></tr></table></figure>
<h2 id="Ncurses-6-1"><a href="#Ncurses-6-1" class="headerlink" title="Ncurses-6.1"></a>Ncurses-6.1</h2><p>Ncurses 软件包包含用于不依赖于特定终端的字符屏幕处理的库。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../ncurses-6.1.tar.gz</span><br><span class="line"><span class="built_in">cd</span> ncurses-6.1</span><br><span class="line"></span><br><span class="line"><span class="comment">#在安装之前，须要确保 gawk 在第一次配置时已经找到：</span></span><br><span class="line">sed -i s/mawk// configure</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools \</span><br><span class="line">            --with-shared   \</span><br><span class="line">            --without-debug \</span><br><span class="line">            --without-ada   \</span><br><span class="line">            --enable-widec  \</span><br><span class="line">            --enable-overwrite</span><br><span class="line">make </span><br><span class="line"></span><br><span class="line">make install</span><br><span class="line">ln -s libncursesw.so /tools/lib/libncurses.so</span><br></pre></td></tr></table></figure>
<h2 id="Bash-5-0"><a href="#Bash-5-0" class="headerlink" title="Bash-5.0"></a>Bash-5.0</h2><p>Bash 软件包包含 Bourne-Again Shell。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../bash-5.0.tar.gz</span><br><span class="line"><span class="built_in">cd</span> bash-5.0</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools --without-bash-malloc</span><br><span class="line">make </span><br><span class="line">make install </span><br><span class="line">ln -sv bash /tools/bin/sh</span><br></pre></td></tr></table></figure>
<h2 id="Bison-3-4-1"><a href="#Bison-3-4-1" class="headerlink" title="Bison-3.4.1"></a>Bison-3.4.1</h2><p>Bison 软件包包含一个语法生成器。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../bison-3.4.1.tar.gz</span><br><span class="line"><span class="built_in">cd</span> bison-3.4.1</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make</span><br><span class="line">make check <span class="comment"># 如果有报错，先忽略</span></span><br><span class="line">make install</span><br></pre></td></tr></table></figure>

<h2 id="Bzip2-1-0-8"><a href="#Bzip2-1-0-8" class="headerlink" title="Bzip2-1.0.8"></a>Bzip2-1.0.8</h2><p>Bzip2 软件包包含压缩和解压缩的程序。用 bzip2 压缩文本文件能获得比传统的 gzip 更好的压缩比。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../bzip2-1.0.8.tar.gz</span><br><span class="line"><span class="built_in">cd</span> bzip2-1.0.8</span><br><span class="line"></span><br><span class="line"><span class="comment">#Bzip2 软件包里没有 configure 配置脚本。用下面的命令编译和测试：</span></span><br><span class="line">make</span><br><span class="line"></span><br><span class="line">make PREFIX=/tools install</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Coreutils-8-31"><a href="#Coreutils-8-31" class="headerlink" title="Coreutils-8.31"></a>Coreutils-8.31</h2><p>Coreutils 软件包包含用于显示和设置基本系统特性的工具。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../coreutils-8.31.tar.xz</span><br><span class="line"><span class="built_in">cd</span> coreutils-8.31</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools --enable-install-program=hostname</span><br><span class="line"></span><br><span class="line">make </span><br><span class="line">make RUN_EXPENSIVE_TESTS=yes check</span><br><span class="line">make install </span><br></pre></td></tr></table></figure>
<h2 id="Diffutils-3-7"><a href="#Diffutils-3-7" class="headerlink" title="Diffutils-3.7"></a>Diffutils-3.7</h2><p>Diffutils 软件包包含显示文件和目录差异的程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../diffutils-3.7.tar.xz</span><br><span class="line"><span class="built_in">cd</span> diffutils-3.7</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br></pre></td></tr></table></figure>
<h2 id="File-5-37"><a href="#File-5-37" class="headerlink" title="File-5.37"></a>File-5.37</h2><p>File 软件包包括一个判断给定的某个或某些文件文件类型的工具。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../file-5.37.tar.gz</span><br><span class="line"><span class="built_in">cd</span> file-5.37</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Findutils-4-6-0"><a href="#Findutils-4-6-0" class="headerlink" title="Findutils-4.6.0"></a>Findutils-4.6.0</h2><p>Findutils 软件包包含查找文件的程序。这些程序提供递归搜索目录树、创建、管理以及搜索数据库（通常比递归式的 find 要快，但如果数据库最近没有更新的话结果不可靠）。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../findutils-4.6.0.tar.gz</span><br><span class="line"><span class="built_in">cd</span> findutils-4.6.0</span><br><span class="line"></span><br><span class="line"><span class="comment">#首先，对应 glibc-2.28 的需求做一些修复：</span></span><br><span class="line">sed -i <span class="string">&#x27;s/IO_ftrylockfile/IO_EOF_SEEN/&#x27;</span> gl/lib/*.c</span><br><span class="line">sed -i <span class="string">&#x27;/unistd/a #include &lt;sys/sysmacros.h&gt;&#x27;</span> gl/lib/mountlist.c</span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;#define _IO_IN_BACKUP 0x100&quot;</span> &gt;&gt; gl/lib/stdio-impl.h</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Gawk-5-0-1"><a href="#Gawk-5-0-1" class="headerlink" title="Gawk-5.0.1"></a>Gawk-5.0.1</h2><p>Gawk 软件包包含用于操作文本文件的程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../gawk-5.0.1.tar.xz</span><br><span class="line"><span class="built_in">cd</span> gawk-5.0.1</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Gettext-0-20-1"><a href="#Gettext-0-20-1" class="headerlink" title="Gettext-0.20.1"></a>Gettext-0.20.1</h2><p>Gettext 软件包包含用于国际化和本土化的工具。这允许用 NLS（Native Language Support，本地语言支持） 编译程序，使得能以用户的本地语言输出信息。<br>对于我们这次用到的临时工具集，我们只需要安装 Gettext 软件包里的 3 个程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../gettext-0.20.1.tar.xz</span><br><span class="line"><span class="built_in">cd</span> gettext-0.20.1</span><br><span class="line"></span><br><span class="line">./configure --disable-shared</span><br><span class="line">make </span><br><span class="line"></span><br><span class="line"><span class="comment">#安装 msgfmt、msgmerge 和 xgettext 程序：</span></span><br><span class="line">cp -v gettext-tools/src/&#123;msgfmt,msgmerge,xgettext&#125; /tools/bin</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Grep-3-3"><a href="#Grep-3-3" class="headerlink" title="Grep-3.3"></a>Grep-3.3</h2><p>Grep 软件包包含用于在文件中搜索的程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../grep-3.3.tar.xz</span><br><span class="line"><span class="built_in">cd</span> grep-3.3</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Gzip-1-10"><a href="#Gzip-1-10" class="headerlink" title="Gzip-1.10"></a>Gzip-1.10</h2><p>Gzip 软件包包含用于压缩和解压文件的程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../gzip-1.10.tar.xz</span><br><span class="line"><span class="built_in">cd</span> gzip-1.10</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Make-4-2-1"><a href="#Make-4-2-1" class="headerlink" title="Make-4.2.1"></a>Make-4.2.1</h2><p>Make 软件包包含一个用于编译软件的程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../make-4.2.1.tar.gz</span><br><span class="line"><span class="built_in">cd</span> make-4.2.1</span><br><span class="line"></span><br><span class="line"><span class="comment">#首先，解决一个 glibc-2.27 或更高版本带来的问题：</span></span><br><span class="line">sed -i <span class="string">&#x27;211,217 d; 219,229 d; 232 d&#x27;</span> glob/glob.c</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools --without-guile</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Patch-2-7-6"><a href="#Patch-2-7-6" class="headerlink" title="Patch-2.7.6"></a>Patch-2.7.6</h2><p>Patch 软件包包含一个通过打「补丁」创建或修改文件的程序，补丁文件通常由 diff 程序生成。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../patch-2.7.6.tar.xz</span><br><span class="line"><span class="built_in">cd</span> patch-2.7.6</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br></pre></td></tr></table></figure>
<h2 id="Perl-5-30-0"><a href="#Perl-5-30-0" class="headerlink" title="Perl-5.30.0"></a>Perl-5.30.0</h2><p>Perl 软件包包含实用信息抽取与报告语言。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../perl-5.30.0.tar.xz</span><br><span class="line"><span class="built_in">cd</span> perl-5.30.0</span><br><span class="line"></span><br><span class="line"><span class="comment">#配置 Perl 准备编译：</span></span><br><span class="line">sh Configure -des -Dprefix=/tools -Dlibs=-lm -Uloclibpth -Ulocincpth</span><br><span class="line"></span><br><span class="line">make </span><br><span class="line"><span class="comment">#虽然 Perl 软件包自带测试套件，最好还是等下一章中它被完整安装之后再运行。</span></span><br><span class="line"><span class="comment">#这次我们只需要安装一小部分的应用和库。</span></span><br><span class="line">cp -v perl cpan/podlators/scripts/pod2man /tools/bin</span><br><span class="line">mkdir -pv /tools/lib/perl5/5.30.0</span><br><span class="line">cp -Rv lib/* /tools/lib/perl5/5.30.0</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Python-3-7-4"><a href="#Python-3-7-4" class="headerlink" title="Python-3.7.4"></a>Python-3.7.4</h2><p>软件包 Python 3 包含了 Python 的开发环境。对于面向对象编程，书写脚本，构建大型程序的原型，或者开发整个应用程序而言，非常有用。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../Python-3.7.4.tar.xz</span><br><span class="line"><span class="built_in">cd</span> Python-3.7.4</span><br><span class="line"></span><br><span class="line"><span class="comment">#这个软件包首先构建 Python 解释器，然后是一些标准的 Python 模块。构建模块的主要脚本是用 Python 编写的，并使用宿主机 /usr/include 和 /usr/lib 目录的硬编码路径。以此防止他们被使用</span></span><br><span class="line">sed -i <span class="string">&#x27;/def add_multiarch_paths/a \        return&#x27;</span> setup.py</span><br><span class="line"></span><br><span class="line"><span class="comment">#配置 Python 准备编译：</span></span><br><span class="line">./configure --prefix=/tools --without-ensurepip</span><br><span class="line"></span><br><span class="line">make</span><br><span class="line"></span><br><span class="line">make install</span><br></pre></td></tr></table></figure>
<h2 id="Sed-4-7"><a href="#Sed-4-7" class="headerlink" title="Sed-4.7"></a>Sed-4.7</h2><p>Sed 软件包包含一个流编辑器。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../sed-4.7.tar.xz</span><br><span class="line"><span class="built_in">cd</span> sed-4.7</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br></pre></td></tr></table></figure>
<h2 id="Tar-1-32"><a href="#Tar-1-32" class="headerlink" title="Tar-1.32"></a>Tar-1.32</h2><p>Tar 软件包包含一个归档程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../tar-1.32.tar.xz</span><br><span class="line"><span class="built_in">cd</span> tar-1.32</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br></pre></td></tr></table></figure>
<h2 id="Texinfo-6-6"><a href="#Texinfo-6-6" class="headerlink" title="Texinfo-6.6"></a>Texinfo-6.6</h2><p>Texinfo 软件包包含用于读、写以及转换信息页的程序。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../texinfo-6.6.tar.xz</span><br><span class="line"><span class="built_in">cd</span> texinfo-6.6</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Util-linux-2-34"><a href="#Util-linux-2-34" class="headerlink" title="Util-linux-2.34"></a>Util-linux-2.34</h2><p>Util-linux 软件包包含了各种各样的小工具。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../util-linux-2.34.tar.xz</span><br><span class="line"><span class="built_in">cd</span> util-linux-2.34</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools                \</span><br><span class="line">            --without-python               \</span><br><span class="line">            --disable-makeinstall-chown    \</span><br><span class="line">            --without-systemdsystemunitdir \</span><br><span class="line">            --without-ncurses              \</span><br><span class="line">            PKG_CONFIG=<span class="string">&quot;&quot;</span></span><br><span class="line">make</span><br><span class="line">make install</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="Xz-5-2-4"><a href="#Xz-5-2-4" class="headerlink" title="Xz-5.2.4"></a>Xz-5.2.4</h2><p>Xz 软件包包含用于压缩和解压文件的程序。它提供 lzma 和更新的 xz 压缩格式功能。和传统的 gzip 或 bzip2 命令相比，用 xz 压缩文本文件能获得更好的压缩率。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources/build</span><br><span class="line">tar xf ../xz-5.2.4.tar.xz</span><br><span class="line"><span class="built_in">cd</span> xz-5.2.4</span><br><span class="line"></span><br><span class="line">./configure --prefix=/tools</span><br><span class="line">make </span><br><span class="line">make check </span><br><span class="line">make install </span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="改变属主"><a href="#改变属主" class="headerlink" title="改变属主"></a>改变属主</h2><p>本书余下部分的命令都必须以 <code>root</code> 用户身份执行而不再是 <code>lfs</code> 用户。另外，再次确认下 <code>$LFS</code> 变量在 <code>root</code> 用户环境下也有定义。</p>
<p>当前，<code>$LFS/tools</code> 目录属于 <code>lfs</code> 用户，这是一个只存在于宿主系统上的帐号。<br>如果继续保持 <code>$LFS/tools</code> 目录的现状，其中的文件将属于一个没有相关联帐号的用户 ID。这很危险，因为随后创建的用户有可能会分配到相同的用户 ID，从而变成 <code>$LFS/tools</code> 目录及其中所有文件的属主，以致留下恶意操作这些文件的可能。</p>
<p>为了解决这个问题，你可以在随后新的 <code>lfs</code> 系统里创建 <code>/etc/passwd</code> 文件时增加一个 <code>lfs</code> 用户，并注意给它分配和宿主系统里相同的用户和组 ID。不过更好的方式是，通过下面的命令将 <code>$LFS/tools</code> 目录的属主改为 <code>root</code> 用户： <code>chown -R root:root $LFS/tools</code></p>
<p>尽管 <code>$LFS/tools</code> 目录可以在 <code>LFS</code> 系统构建完成后删除，但仍然可以保留下来用于 构建额外的相同版本 LFS 系统。备份 $LFS/tools 目录到底有多少好处取决于你个人。</p>
<p>如果你想保留临时工具用来构建新的 LFS 系统，现在就要备份好。本书随后第六章中的指令将对当前的工具做些调整，导致在构建新系统时会失效。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#切换到root用户</span></span><br><span class="line">sudo su - root</span><br><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#查看目录空间大小</span></span><br><span class="line">8.1G    sources/build</span><br><span class="line">422M    sources.back</span><br><span class="line">2.5G    tools</span><br><span class="line"><span class="comment">#备份 tools目录</span></span><br><span class="line">cp -Rv tools tools.back</span><br><span class="line"></span><br><span class="line"><span class="comment">#修改tools目录属主</span></span><br><span class="line">chown -R root:root <span class="variable">$LFS</span>/tools</span><br></pre></td></tr></table></figure>
    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/LFS/" rel="tag"># LFS</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/05/13/lfs-notebook-03/" rel="prev" title="lfs-notebook-03">
      <i class="fa fa-chevron-left"></i> lfs-notebook-03
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/05/19/lfs-notebook-05/" rel="next" title="lfs-notebook-05">
      lfs-notebook-05 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#LFS%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0%EF%BC%88%E5%9B%9B%EF%BC%89"><span class="nav-number">1.</span> <span class="nav-text">LFS学习笔记（四）</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Tcl-8-6-9"><span class="nav-number">1.1.</span> <span class="nav-text">Tcl-8.6.9</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Tcl-%E8%BD%AF%E4%BB%B6%E5%8C%85%E5%86%85%E5%AE%B9"><span class="nav-number">1.1.1.</span> <span class="nav-text">Tcl 软件包内容</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Expect-5-45-4"><span class="nav-number">1.2.</span> <span class="nav-text">Expect-5.45.4</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#DejaGNU-1-6-2"><span class="nav-number">1.3.</span> <span class="nav-text">DejaGNU-1.6.2</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#M4-1-4-18"><span class="nav-number">1.4.</span> <span class="nav-text">M4-1.4.18</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Ncurses-6-1"><span class="nav-number">1.5.</span> <span class="nav-text">Ncurses-6.1</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Bash-5-0"><span class="nav-number">1.6.</span> <span class="nav-text">Bash-5.0</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Bison-3-4-1"><span class="nav-number">1.7.</span> <span class="nav-text">Bison-3.4.1</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Bzip2-1-0-8"><span class="nav-number">1.8.</span> <span class="nav-text">Bzip2-1.0.8</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Coreutils-8-31"><span class="nav-number">1.9.</span> <span class="nav-text">Coreutils-8.31</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Diffutils-3-7"><span class="nav-number">1.10.</span> <span class="nav-text">Diffutils-3.7</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#File-5-37"><span class="nav-number">1.11.</span> <span class="nav-text">File-5.37</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Findutils-4-6-0"><span class="nav-number">1.12.</span> <span class="nav-text">Findutils-4.6.0</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Gawk-5-0-1"><span class="nav-number">1.13.</span> <span class="nav-text">Gawk-5.0.1</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Gettext-0-20-1"><span class="nav-number">1.14.</span> <span class="nav-text">Gettext-0.20.1</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Grep-3-3"><span class="nav-number">1.15.</span> <span class="nav-text">Grep-3.3</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Gzip-1-10"><span class="nav-number">1.16.</span> <span class="nav-text">Gzip-1.10</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Make-4-2-1"><span class="nav-number">1.17.</span> <span class="nav-text">Make-4.2.1</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Patch-2-7-6"><span class="nav-number">1.18.</span> <span class="nav-text">Patch-2.7.6</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Perl-5-30-0"><span class="nav-number">1.19.</span> <span class="nav-text">Perl-5.30.0</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Python-3-7-4"><span class="nav-number">1.20.</span> <span class="nav-text">Python-3.7.4</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Sed-4-7"><span class="nav-number">1.21.</span> <span class="nav-text">Sed-4.7</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Tar-1-32"><span class="nav-number">1.22.</span> <span class="nav-text">Tar-1.32</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Texinfo-6-6"><span class="nav-number">1.23.</span> <span class="nav-text">Texinfo-6.6</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Util-linux-2-34"><span class="nav-number">1.24.</span> <span class="nav-text">Util-linux-2.34</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Xz-5-2-4"><span class="nav-number">1.25.</span> <span class="nav-text">Xz-5.2.4</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%94%B9%E5%8F%98%E5%B1%9E%E4%B8%BB"><span class="nav-number">1.26.</span> <span class="nav-text">改变属主</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Movie</p>
  <div class="site-description" itemprop="description">学习，记录，分享，收获</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">14</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Movie</span>
</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>











<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'forest',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'bx3R5BB7VYCe0Yu5f4PF2Ako-gzGzoHsz',
      appKey     : '24eOkgM1v8hYTlnAO3C2eG3n',
      placeholder: "欢迎留言评论",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : 'zh-cn' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
